/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize exports="amd" -o ./compat/`
 * Copyright 2012-2014 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define(['../internals/baseDifference', '../internals/baseFlatten', '../internals/baseForIn', '../functions/createCallback'], function(baseDifference, baseFlatten, baseForIn, createCallback) {

  /**
   * Creates a shallow clone of `object` excluding the specified properties.
   * Property names may be specified as individual arguments or as arrays of
   * property names. If a callback is provided it will be executed for each
   * property of `object` omitting the properties the callback returns truey
   * for. The callback is bound to `thisArg` and invoked with three arguments;
   * (value, key, object).
   *
   * @static
   * @memberOf _
   * @category Objects
   * @param {Object} object The source object.
   * @param {Function|...string|string[]} [callback] The properties to omit or the
   *  function called per iteration.
   * @param {*} [thisArg] The `this` binding of `callback`.
   * @returns {Object} Returns an object without the omitted properties.
   * @example
   *
   * _.omit({ 'name': 'fred', 'age': 40 }, 'age');
   * // => { 'name': 'fred' }
   *
   * _.omit({ 'name': 'fred', 'age': 40 }, function(value) {
   *   return typeof value == 'number';
   * });
   * // => { 'name': 'fred' }
   */
  function omit(object, callback, thisArg) {
    var result = {};
    if (typeof callback != 'function') {
      var props = [];
      baseForIn(object, function(value, key) {
        props.push(key);
      });
      props = baseDifference(props, baseFlatten(arguments, true, false, 1));

      var index = -1,
          length = props.length;

      while (++index < length) {
        var key = props[index];
        result[key] = object[key];
      }
    } else {
      callback = createCallback(callback, thisArg, 3);
      baseForIn(object, function(value, key, object) {
        if (!callback(value, key, object)) {
          result[key] = value;
        }
      });
    }
    return result;
  }

  return omit;
});
